const Mock = require('mockjs')

const NameList = []
const count = 100

for (let i = 0; i < count; i++) {
  NameList.push(Mock.mock({
    name: '@first'
  }))
}
NameList.push({ name: 'mock-Pan' })

module.exports = [
  // username search
  {
    url: '/vue-element-admin/search/user',
    type: 'get',
    response: config => {
      const { name } = config.query
      const mockNameList = NameList.filter(item => {
        const lowerCaseName = item.name.toLowerCase()
        return !(name && lowerCaseName.indexOf(name.toLowerCase()) < 0)
      })
      return {
        code: 20000,
        data: { items: mockNameList }
      }
    }
  },

  // transaction list
  {
    url: '/vue-element-admin/transaction/list',
    type: 'get',
    response: _ => {
      return {
        code: 20000,
        data: {
          total: 20,
          'items|20': [{
            order_no: '@guid()',
            timestamp: +Mock.Random.date('T'),
            username: '@name()',
            price: '@float(1000, 15000, 0, 2)',
            'status|1': ['success', 'pending']
          }]
        }
      }
    }
  },
  // transaction list
  {
    url: '/tagvalue/',
    type: 'get',
    response: _ => {
      return {
        "success": true,
        "message": "请求成功",
        "data": [ {
          "id": "F001",
          "value": "男",
          "lv1": "F",
          "lv2": "0",
          "lv3": "01",
         },
         {
          "id": "F002",
          "value": "女",
          "lv1": "F",
          "lv2": "0",
          "lv3": "01",
         }
        ]
      }
    }
  },
  {
    url: '/comsumer/get',
    type: 'post',
    response: _ => {
      return {
        "success": true,
        "message": "请求成功",
        "data": {
          total:200,
          data:[ {
            "id": "F001",
            "value": "男",
            "lv1": "F",
            "lv2": "0",
            "lv3": "01",
           },
           {
            "id": "F002",
            "value": "女",
            "lv1": "F",
            "lv2": "0",
            "lv3": "01",
           }
          ]
        }
      }
    }
  },
  {
    url: '/comsumergroup/all',
    type: 'post',
    response: _ => {
      return {
          "success": true,
          "message": "请求成功",
          "data": [
              {
                  "id": 1,
                  "groupname": "青年人群",
                  "args": "[\n  {\n    \"attrid\": \"T00001\",\n    \"attrname\": \"准确年龄\",\n    \"attrrank\": \"T\",\n    \"superid\": \"S0001\",\n    \"roleid\": \"01\",\n    \"fieldname\": \"client_age\",\n    \"valuetype\": \"int\",\n    \"children\": null,\n    \"aaa\": \"\",\n    \"logicalConnective\": \"eq\",\n    \"values\": [\n      \"12\"\n    ]\n  },\n  {\n    \"key\": 744,\n    \"attrname\": \"&\",\n    \"type\": \"success\"\n  },\n  {\n    \"attrid\": \"T00113\",\n    \"attrname\": \"客户手机号\",\n    \"attrrank\": \"T\",\n    \"superid\": \"S0001\",\n    \"roleid\": \"01\",\n    \"fieldname\": \"client_phone\",\n    \"valuetype\": \"string\",\n    \"children\": null,\n    \"aaa\": \"\",\n    \"logicalConnective\": \"eq\",\n    \"values\": [\n      \"166\"\n    ]\n  },\n  {\n    \"key\": 769,\n    \"attrname\": \"|\",\n    \"type\": \"success\"\n  },\n  {\n    \"attrid\": \"T00114\",\n    \"attrname\": \"客户姓名\",\n    \"attrrank\": \"T\",\n    \"superid\": \"S0001\",\n    \"roleid\": \"01\",\n    \"fieldname\": \"client_name\",\n    \"valuetype\": \"string\",\n    \"children\": null,\n    \"aaa\": \"\",\n    \"logicalConnective\": \"eq\",\n    \"values\": [\n      \"lkk\"\n    ]\n  }\n]",
                  "creater": "admin",
                  "createtime": "2021-08-23",
                  "total": 4000,
                  "description": null
              },
              {
                  "id": 2,
                  "groupname": "营销客群",
                  "args": "[\n  {\n    \"attrid\": \"T00001\",\n    \"attrname\": \"准确年龄\",\n    \"attrrank\": \"T\",\n    \"superid\": \"S0001\",\n    \"roleid\": \"01\",\n    \"fieldname\": \"client_age\",\n    \"valuetype\": \"int\",\n    \"children\": null,\n    \"aaa\": \"\",\n    \"logicalConnective\": \"eq\",\n    \"values\": [\n      \"12\"\n    ]\n  },\n  {\n    \"key\": 744,\n    \"attrname\": \"&\",\n    \"type\": \"success\"\n  },\n  {\n    \"attrid\": \"T00113\",\n    \"attrname\": \"客户手机号\",\n    \"attrrank\": \"T\",\n    \"superid\": \"S0001\",\n    \"roleid\": \"01\",\n    \"fieldname\": \"client_phone\",\n    \"valuetype\": \"string\",\n    \"children\": null,\n    \"aaa\": \"\",\n    \"logicalConnective\": \"eq\",\n    \"values\": [\n      \"166\"\n    ]\n  },\n  {\n    \"key\": 769,\n    \"attrname\": \"|\",\n    \"type\": \"success\"\n  },\n  {\n    \"attrid\": \"T00114\",\n    \"attrname\": \"客户姓名\",\n    \"attrrank\": \"T\",\n    \"superid\": \"S0001\",\n    \"roleid\": \"01\",\n    \"fieldname\": \"client_name\",\n    \"valuetype\": \"string\",\n    \"children\": null,\n    \"aaa\": \"\",\n    \"logicalConnective\": \"eq\",\n    \"values\": [\n      \"lkk\"\n    ]\n  }\n]",
                  "creater": "admin",
                  "createtime": "2021-08-13",
                  "total": 59888,
                  "description": null
              }
        ]
      }
    }
  },

  // transaction list
  {
    url: '/tag/tree',
    type: 'get',
    response: _ => {
      return {
        "success": true,
        "message": "请求成功",
        "data": [
          {
            "attrid": "F001",
            "attrname": "人口属性",
            "attrrank": "F",
            "superid": "0",
            "roleid": "01",
            "fieldname": null,
            "valuetype": null,
            "children": [
              {
                "attrid": "S0001",
                "attrname": "基本信息",
                "attrrank": "S",
                "superid": "F001",
                "roleid": "01",
                "fieldname": null,
                "valuetype": null,
                "children": [
                  {
                    "attrid": "T00001",
                    "attrname": "准确年龄",
                    "attrrank": "T",
                    "superid": "S0001",
                    "roleid": "01",
                    "fieldname": "client_age",
                    "valuetype": "int",
                    "children": null
                  },
                  {
                    "attrid": "T00005",
                    "attrname": "性别描述",
                    "attrrank": "T",
                    "superid": "S0001",
                    "roleid": "01",
                    "fieldname": "client_gender",
                    "valuetype": "string",
                    "children": null
                  },
                  {
                    "attrid": "T00113",
                    "attrname": "客户手机号",
                    "attrrank": "T",
                    "superid": "S0001",
                    "roleid": "01",
                    "fieldname": "client_phone",
                    "valuetype": "string",
                    "children": null
                  },
                  {
                    "attrid": "T00114",
                    "attrname": "客户姓名",
                    "attrrank": "T",
                    "superid": "S0001",
                    "roleid": "01",
                    "fieldname": "client_name",
                    "valuetype": "string",
                    "children": null
                  }
                ]
              }
            ]
          },
          {
            "attrid": "F004",
            "attrname": "保险属性",
            "attrrank": "F",
            "superid": "0",
            "roleid": "01",
            "fieldname": null,
            "valuetype": null,
            "children": [
              {
                "attrid": "S0005",
                "attrname": "保险信息",
                "attrrank": "S",
                "superid": "F004",
                "roleid": "01",
                "fieldname": null,
                "valuetype": null,
                "children": [
                  {
                    "attrid": "T00027",
                    "attrname": "渠道大类",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": null,
                    "valuetype": "enum",
                    "children": null
                  },
                  {
                    "attrid": "T00112",
                    "attrname": "客户对应业务员编码",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": null,
                    "valuetype": "string",
                    "children": null
                  },
                  {
                    "attrid": "T00116",
                    "attrname": "产品分析",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": "client_product",
                    "valuetype": "string",
                    "children": null
                  },
                  {
                    "attrid": "T00117",
                    "attrname": "最近一次投保间隔（最新）",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": "last_datediff",
                    "valuetype": "long",
                    "children": null
                  },
                  {
                    "attrid": "T00118",
                    "attrname": "加保指数 ",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": "",
                    "valuetype": "double",
                    "children": null
                  },
                  {
                    "attrid": "T00119",
                    "attrname": "加保指数全国排名",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": null,
                    "valuetype": "int",
                    "children": null
                  },
                  {
                    "attrid": "T00120",
                    "attrname": "加保指数全省排名",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": null,
                    "valuetype": "int",
                    "children": null
                  },
                  {
                    "attrid": "T00121",
                    "attrname": "加保星级",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": null,
                    "valuetype": "int",
                    "children": null
                  },
                  {
                    "attrid": "T00123",
                    "attrname": "客户机构",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": "branch_code",
                    "valuetype": "string",
                    "children": null
                  },
                  {
                    "attrid": "T00195",
                    "attrname": "福临门系列客户",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": null,
                    "valuetype": "boolean",
                    "children": null
                  },
                  {
                    "attrid": "T00196",
                    "attrname": "重疾险系列客户",
                    "attrrank": "T",
                    "superid": "S0005",
                    "roleid": "01",
                    "fieldname": null,
                    "valuetype": "boolean",
                    "children": null
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  }
]
